function messageSend() {
    msg = document.getElementById("msg").value

    if (msg == "") {
        error_bar("太少了字")
        return
    }

    $.post("/chat/post",{
        msg: msg
    },function(data) {
        if (data.msg != "") {
            error_bar(data.msg)
            return
        }
        loadChat()
    })
}

loadChat()

function loadChat() {
    temp = `
    <div class="mdui-card">

  <!-- 卡片头部，包含头像、标题、副标题 -->
  <div class="mdui-card-header">
    <img class="mdui-card-header-avatar" src="AVATOR"/>
    <div class="mdui-card-header-title">USERNAME</div>
    <div class="mdui-card-header-subtitle">TIMETIME</div>
  </div>


  <!-- 卡片的内容 -->
  <div class="mdui-card-content">MSGMSG</div>


</div>
    `
    
    document.getElementById("look").innerHTML = ''
    $.get("/chat/get",function(data) {
        for (let i in data) {
            ele = data[i]
            document.getElementById("look").innerHTML += temp
                                                        .replaceAll("AVATOR",getFacerPath(ele.uid))
                                                        .replaceAll("USERNAME",sysuser[ele.uid].realname)
                                                        .replaceAll("MSGMSG",ele.msg)
                                                        .replaceAll("TIMETIME",ele.create_time)
        }
    })
}